/**
 * 信息确认弹窗
 * @param text 
 * @returns 
 */

import { ElMessageBox, ElMessage } from 'element-plus'

export default async function myMessageBox(text: string) {
    try {
        return await new Promise((resolve, reject) => {
            ElMessageBox.confirm('你确定要' + text + '么？', '温馨提示',
                {
                    confirmButtonText: '确定',
                    cancelButtonText: '取消',
                    type: 'warning',
                }
            )
                .then(() => {
                    ElMessage({
                        type: 'success',
                        message: text + '成功！',
                    })
                    resolve(true)
                })
                .catch(() => {
                    reject(false)
                })
        })
    } catch {
        return false
    }
}